package com.nowcoder.community;

import com.nowcoder.community.entity.Comment;
import com.nowcoder.community.service.CommentService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = CommunityApplication.class)
public class commentIdtest {
    @Autowired
    private CommentService commentService;
    @Test
    public void test1(){
        Comment comment = new Comment();
        comment.setContent("aisdjf");
        comment.setUserId(111);
        comment.setStatus(0);
        comment.setCreateTime(new Date());
        commentService.addComment(comment);
        System.out.println(comment.getId());

    }
}
